package org.example.design.designmode.flyweight.ticket;

import java.util.Random;

public class TrainTicket implements ITicket{

    private  String form;
    private  String to;
    private  int price;

    public TrainTicket(String form, String to) {
        this.form = form;
        this.to = to;
    }

    @Override
    public void showInfo(String type) {
        price =new Random().nextInt(500);

        System.out.println(form+">"+to+"价格："+price+"元");
    }
}
